package com.ruoyi.bl.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.bl.mapper.BlCartMapper;
import com.ruoyi.bl.domain.BlCart;
import com.ruoyi.bl.service.IBlCartService;

/**
 * 购物车Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-11-27
 */
@Service
public class BlCartServiceImpl implements IBlCartService 
{
    @Autowired
    private BlCartMapper blCartMapper;

    /**
     * 查询购物车
     * 
     * @param cartId 购物车主键
     * @return 购物车
     */
    @Override
    public BlCart selectBlCartByCartId(Long cartId)
    {
        return blCartMapper.selectBlCartByCartId(cartId);
    }

    /**
     * 查询购物车列表
     * 
     * @param blCart 购物车
     * @return 购物车
     */
    @Override
    public List<BlCart> selectBlCartList(BlCart blCart)
    {
        return blCartMapper.selectBlCartList(blCart);
    }

    /**
     * 新增购物车
     * 
     * @param blCart 购物车
     * @return 结果
     */
    @Override
    public int insertBlCart(BlCart blCart)
    {
        blCart.setCreateTime(DateUtils.getNowDate());
        return blCartMapper.insertBlCart(blCart);
    }

    /**
     * 修改购物车
     * 
     * @param blCart 购物车
     * @return 结果
     */
    @Override
    public int updateBlCart(BlCart blCart)
    {
        blCart.setUpdateTime(DateUtils.getNowDate());
        return blCartMapper.updateBlCart(blCart);
    }

    /**
     * 批量删除购物车
     * 
     * @param cartIds 需要删除的购物车主键
     * @return 结果
     */
    @Override
    public int deleteBlCartByCartIds(Long[] cartIds)
    {
        return blCartMapper.deleteBlCartByCartIds(cartIds);
    }

    /**
     * 删除购物车信息
     * 
     * @param cartId 购物车主键
     * @return 结果
     */
    @Override
    public int deleteBlCartByCartId(Long cartId)
    {
        return blCartMapper.deleteBlCartByCartId(cartId);
    }
}
